package com.jesse.custom;

import com.jesse.main.R;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;

public class EmptyAlertStub extends LinearLayout{

	private TextView alertTextView;
	private ProgressBar progressBar;
	public EmptyAlertStub(Context context) {
		super(context);
	}

	public EmptyAlertStub(Context context, AttributeSet attrs) {
		super(context, attrs);
		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View layout = inflater.inflate(R.layout.unit_empty_alert, this);
		alertTextView = (TextView) layout.findViewById(R.id.emptyAlertText);
		progressBar = (ProgressBar) layout.findViewById(R.id.emptyAlertBar);
		hide();
	}
	
	public void hide() {
		hideWating();
	}
	
	public void initText(String alertText) {
		alertTextView.setText(alertText);
	}
	
	public void showText() {
		progressBar.setVisibility(View.GONE);
		alertTextView.setVisibility(View.VISIBLE);
	}
	
	public void showText(String alertText) {
		showText();
		alertTextView.setText(alertText);
	}
	
	public void hideText() {
		progressBar.setVisibility(View.GONE);
		alertTextView.setVisibility(View.GONE);
	}
	
	public void showWating() {
		showText();
		progressBar.setVisibility(View.VISIBLE);
	}
	
	public void showWating(String text) {
		showText(text);
		progressBar.setVisibility(View.VISIBLE);
	}
	
	public void hideWating() {
		hideText();
		progressBar.setVisibility(View.GONE);
	}
}
